package com.econ.powercloud.ems.common.enums;

import java.util.Arrays;
import java.util.List;

/**
 * 群控记录状态枚举
 * @author jwc
 * @date 2023/06/01
 */
public enum ControlRecordStatusEnum implements EnumMethod{
    NOT_STARTED(1,"未开始"),
    IN_PROGRESS(2,"进行中"),
    SUCCESS(3,"成功"),
    FAIL(4,"失败"),
    /*TERMINATED(5,"已终止"),
    UNCONFIRMED(6,"待确认成功"),*/
    ;

    private Integer code;
    private String desc;


    ControlRecordStatusEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    @Override
    public Integer getCode() {
        return code;
    }

    @Override
    public String getDesc() {
        return desc;
    }

    public static String fromCode(Integer code) {
        ControlRecordStatusEnum obj = Arrays.stream(ControlRecordStatusEnum.values()).filter(item -> item.getCode().equals(code)).findFirst().orElse(null);
        return obj != null ? obj.getDesc() : "";
    }

}
